#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author   : Moty
# @Time     : 2024/1/22 0:12
# @File     : jt808_0104.py
# @Project  : jt808
from utils.common.dicUtil import parse_terminal_param_reply_hex


def parse_terminal_param_reply(body):
    # 解析0x0104 查询终端参数应答
    data = {
        "应答流水号": body[0:4],
        "应答参数个数": str(int(body[4:6], 16)) + body[4:6],
        "参数项列表": parse_terminal_param_reply_hex(body[6:]),
    }
    formatted_data = ""
    for key, value in data.items():
        formatted_data += f"{key}: {value}\n"
    return formatted_data


__all__ = ['parse_terminal_param_reply']
